package com.jec.module;

import java.util.Properties;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jec.Bootstrap;
import com.jec.utils.Response;

@Controller
@RequestMapping(value = "/version")
public class VersionController {
	
    @RequestMapping(method = RequestMethod.GET)
    public @ResponseBody
    Response index(){
    	
    	Properties p = Bootstrap.getApplicationProperties();
    	String version = p.getProperty("version");
    	if(version == null) {
    		version = "1.0.0";
    	}
    	
        return Response.Builder(version);
    }

}
